package com.baijiaoxi.common.model.base.model.base;

import java.util.HashMap;
import java.util.Map;

/**
 * 实现接口在service plugin中查询之后可以控制哪些行为应当被执行
 */
public interface InterceptorControlModel {
    default InterceptorControlModel setFillSetting(String settingKey, String val) {
        Map<String, String> fillSetting = getFillSetting();
        if (fillSetting == null) {
            fillSetting = new HashMap<>();
            setFillSetting(fillSetting);
        }
        fillSetting.put(settingKey, val);
        return this;
    }

    default String getFillSetting(String settingKey) {
        Map<String, String> fillSetting = getFillSetting();
        if (fillSetting == null)
            return null;
        return fillSetting.get(settingKey);
    }

    default Map<String, String> getFillSetting() {
        return null;
    }

    default void setFillSetting(Map<String, String> fillSetting) {
    }
}
